/**
*      author: Y_Yao
*      created: 2024-12-11 19:45:14
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const signed INF = 0x3f3f3f3f;
const LL LLINF = 1e18;
const int N = 200 + 7;
int k[N];
int n,a,b;
int dist[N];

void dfs(int cur,int step)
{
    dist[cur] = step;

    // for(int i = 1;i <= 2;i++)
    // {
    //     int next = 0;
    //     if(i == 1)
    //     {
    //         next = cur + k[cur];
    //         if(next > n) continue;
    //     }
    //     else
    //     {
    //         next = cur - k[cur];
    //         if(next < 1) continue; 
    //     }
    //     dfs(next,step + 1);
    // }
    if(cur+k[cur]<=n && step+1<dist[cur+k[cur]])
		dfs(cur+k[cur],step+1);
	if(cur-k[cur]>0  && step+1<dist[cur-k[cur]])
		dfs(cur-k[cur],step+1);
}

void solve()
{
    cin >> n >> a >> b;
    memset(dist,INF,sizeof dist);
    for(int i = 1;i <= n;i++)
    {
        cin >> k[i];
    }

    dfs(a,0);
    if((signed)dist[b] != INF) cout << dist[b] << endl;
    else cout << -1 << endl;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}